﻿using UnityEngine;
using System.Collections;

public class FX_PauseParticle : MonoBehaviour {

	ParticleSystem ps;
	ParticleSystem[] psChild;
	//public bool bPause;
	public float timeToPlay;
	void Awake()
	{
		ps = GetComponent<ParticleSystem>();
		psChild = GetComponentsInChildren<ParticleSystem>();

	}
	// Use this for initialization
	void Start () {
		ps.Simulate(timeToPlay);

	}
	/*
	// Update is called once per frame
	void Update () {
		if(ps==null)
			return;
		if(!ps.isPaused) {
			if(timeToPlay>0) {
				if(ps.time>=timeToPlay) {
					//bPause=true;
					ps.Pause();
					//ps.particleEmitter.enabled=false;
					foreach(ParticleSystem p in psChild) {
						p.Pause();
						//p.particleEmitter.enabled=false;
						//p.enableEmission=false;
					}
					
				}
			}
		}
	}*/
}
